package com.hoo.common.constant;

/**
 * <p> 文件描述： ...    <p/>
 * <p/>
 * 创建日期 11/25/14 22:17
 *
 * @author wangqingfeng
 * @version 1.1
 * @since CodingExample　Ver(编码范例查看) 1.1
 */
public class Common {

    // 取异常堆栈的前三行
    public static String errorException(Exception e) {
        StackTraceElement[] ste = e.getStackTrace();
        if (ste == null) {
            return null;
        }
        StringBuffer sb = new StringBuffer(e.getClass().toString() + ":");
        sb.append(e.getMessage() + "\n ");
        int elength = ste.length > 3 ? 3 : ste.length;
        for (int i = 0; i < elength; i++) {
            sb.append(ste[i].toString() + "\n ");
        }
        return sb.toString();
    }
}


